﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Castle.ActiveRecord;

namespace LIMS.Entities
{
    /// <summary>
    /// Mail Scheduler
    /// </summary>
    [ActiveRecord(Lazy = true)]
    [Serializable]
    public class MailSchedule : ActiveRecordBase
    {
        public MailSchedule()
        {
        }

        #region Private

        private int id;
        private int iType = 0;
        private int iLanguageId = 0;        
        private string sTo = string.Empty;
        private string sCC = string.Empty;
        private string sFrom = string.Empty;
        private string sSubject = string.Empty;
        private string sBody = string.Empty;
        private int iIncludeAttachment = 0;
        private int iDocType = 0;
        private string sNotes = string.Empty;
        private DateTime? oScheduleDate;
        private DateTime? oActualSentDate;
        private DateTime? createdDateTime;
        private DateTime? lastModifiedDateTime;
        private int createdBy;
        private int lastModifiedBy;
        private string status = string.Empty;
        private string sStatusNotes = string.Empty;
        private bool sIsRecursive = false;
        private string entityType = string.Empty;
        private string entityUniqueNumber = string.Empty;              
        #endregion

        #region Public
        [PrimaryKey(PrimaryKeyType.Increment)]
        public virtual int Id
        {
            get { return id; }
            set { id = value; }
        }

        /// <summary>
        /// 1- Service Poll Interval Based
        /// 2- Hourly
        /// 3- Daily
        /// 4- Weekly
        /// 5- Monthly
        /// 
        /// 9- Custom : Uses ScheduleDate Column of this table to put custom date on which mail is to be sent
        /// </summary>
        public virtual int Type
        {
            get { return iType; }
            set { iType = value; }
        }

        public virtual int LanguageId
        {
            get { return iLanguageId; }
            set { iLanguageId = value; }
        }
        public virtual string To
        {
            get { return sTo; }
            set { sTo = value; }
        }     
        public virtual string From
        {
            get { return sFrom; }
            set { sFrom = value; }
        }

        public virtual string CC
        {
            get { return sCC; }
            set { sCC = value; }
        }

        public virtual string Subject
        {
            get { return sSubject; }
            set { sSubject = value; }
        }

        public virtual string Body
        {
            get { return sBody; }
            set { sBody = value; }
        }

        /// <summary>
        /// 0 - No Attachments
        /// 1 - Include Attachments
        /// </summary>
        public virtual int IncludeAttachment
        {
            get { return iIncludeAttachment; }
            set { iIncludeAttachment = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        public virtual int DocType
        {
            get { return iDocType; }
            set { iDocType = value; }
        }

        /// <summary>
        ///  Custom Notes or Error Messages
        /// </summary>
        public virtual string Notes
        {
            get { return sNotes; }
            set { sNotes = value; }
        }

        /// <summary>
        /// Schedule Date - Mail will be sent on this date
        /// </summary>
        public virtual DateTime? ScheduleDate
        {
            get { return oScheduleDate; }
            set { oScheduleDate = value; }
        }

        /// <summary>
        /// Mail Sent actually on this date
        /// </summary>
        public virtual DateTime? ActualSentDate
        {
            get { return oActualSentDate; }
            set { oActualSentDate = value; }
        }

        /// <summary>
        /// R - Ready To Send
        /// S - Success
        /// F - Failure
        /// D - Deleted 
        /// A - Active
        /// </summary>
        public virtual string Status
        {
            get { return status; }
            set { status = value; }
        }

        public virtual string StatusNotes
        {
            get { return sStatusNotes; }
            set { sStatusNotes = value; }
        }

        public virtual DateTime? CreatedDateTime
        {
            get { return createdDateTime; }
            set { createdDateTime = value; }
        }
        public virtual DateTime? LastModifiedDateTime
        {
            get { return lastModifiedDateTime; }
            set { lastModifiedDateTime = value; }
        }
        public virtual int CreatedBy
        {
            get { return createdBy; }
            set { createdBy = value; }
        }
        public virtual int LastModifiedBy
        {
            get { return lastModifiedBy; }
            set { lastModifiedBy = value; }
        }
        /// <summary>
        /// true for recursive mail
        /// false for not recursive mail
        /// </summary>
        public virtual bool IsRecursive
        {
            get { return sIsRecursive; }
            set { sIsRecursive = value; }
        }
        /// <summary>
        /// Define Entity Type from The Application - 
        /// I = Invoice
        /// </summary>
        public virtual string EntityType
        {
            get { return entityType; }
            set { entityType = value; }
        }
        /// <summary>
        /// Define Entity's unique number -
        /// For Invoice it is = Invoice Number
        /// </summary>
        public virtual string EntityUniqueNumber
        {
            get { return entityUniqueNumber; }
            set { entityUniqueNumber = value; }
        } 
        #endregion
    }
}
